<%@ page import="question.ClassifyInfo" %>
<%@ page import="com.opensymphony.xwork2.util.ValueStack" %>
<%@ page import="java.util.List" %>
<%@ page import="utils.TextUtils" %>
<%@ page import="java.util.Map" %>
<%@ page import="setup.SetupInfo" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title></title>
<link href="../../skin/default/global.css" rel="stylesheet" type="text/css" />
<link href="../../skin/default/layout.css" rel="stylesheet" type="text/css" />
   <style>
    	html,body{overflow-x:hidden}
    </style>
</head>
<%
  ValueStack vs = (ValueStack) request.getAttribute("struts.valueStack");
  List<ClassifyInfo> dtList = (List<ClassifyInfo>) vs.findValue("dtList");
  Map<Integer, List<ClassifyInfo>> ydMap = (Map<Integer, List<ClassifyInfo>>) vs.findValue("ydMap");
  Map<Integer, SetupInfo> setupMap = (Map<Integer, SetupInfo>) vs.findValue("setupMap");
%>
<body class="admin-content admin-panel-body">
<div id="pop">剩余分值：50 分</div>
<form action="setup.action" method="post">
<div class="admin-tablenav" style="float:right; margin-bottom:-10px;">
  <button type="submit" class="normal blue">
    <span></span>保存修改
  </button>
</div>

	<table cellpadding="0"  cellspacing="0" class="admin-table" style="width:98%">
		<thead>
			<tr>
				<th style="width:30px"><span class="first"></span>编码</th>
				<th style="width:120px">考试项目</th>
				<%--<th style="width:150px">考试范围</th>--%>
				<th>考试要点</th>
				<th style="width:40px;" class="last">分值</th>
			</tr>
		</thead>
		<tbody id="rightslist">
      <%
        int index = 0;
        for(ClassifyInfo dt : dtList){
          List<ClassifyInfo> ydList = ydMap.get(dt.getCid());
          for(ClassifyInfo yd : ydList){
            SetupInfo setup = setupMap.get(yd.getCid());
      %>
      <tr>
				<td class="first"><%=++index%></td>
				<td><%=TextUtils.html(dt.getCname())%>&nbsp;</td>
				<!--<td>&nbsp;</td>-->
				<td><%=TextUtils.html(yd.getCname())%>&nbsp;</td>
				<td class="last"><input onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))" name="yd_<%=yd.getCid()%>" class="numInput" value="<%=setup == null ? 0 : setup.getYdValue()%>" style="width:80%; height:20px; border:1px solid #999; font-size:16px;padding:3px;"/></td>
			</tr>
      <%
          }
        }
      %>
    </tbody>
		<tfoot>
			<tr>
				<td colspan="10" style="padding-right:15px" class="last"><span class="first"></span>
				总分：100
				</td>
			</tr>
		</tfoot>
	</table>
<div class="admin-tablenav" style="float:right; margin-top:-10px;">
  <button type="submit" class="normal blue">
    <span></span>保存修改
  </button>
</div>
<script src="../../common/jquery-1.3.2.min.js"></script>
<script src="../../common/fun.js"></script>
	<script>
		$(function(){
		  	checkNum()
		  })
		var list = new KS.List("rightslist")
		 $("#rightslist tr").hover(function(){
		 	
		  	$(this).find("input").select()
			
		  },function(){
		  	  
		  }).click(function(){
		  	  $(this).find("input").select()
		  	  }).find("input").focus(function(){
			  	$("#pop").css({
				left:$(this).offset().left-113,
				top:$(this).offset().top
			})
			checkNum()
			  })
			  
		function checkNum(){
			var _all = 100;
			var _last = 0;
			var allinput = $(".numInput")
			allinput.each(function(i){
				
				if(IsNum($(this).val())){
					_last += parseInt($(this).val())
				}
				
			})
			if(100-_last<0){
			$("#pop").html("分数设置过大")
			}
			else{
			$("#pop").html("剩余分值："+(100-_last)+"分")	
			}
		}
		
		function IsNum(s)
		{
			if (s!=null && s!="")
			{
				return !isNaN(s);
			}
			return false;
		}

		
	</script>
</form>
</body>

</html>
